from flask import Flask, request, jsonify
import subprocess
import os
import sys
from ai_reason_flow import process_flow


app = Flask(__name__)

@app.route("/agent/process_flow", methods=["POST"])
def _process_flow():
    # 获取POST请求中的数据
    data = request.json.get("data", "")

    message = process_flow(data)

    return jsonify({"result": {"messages": [message]}})


if __name__ == "__main__":
    # 启动服务，监听端口8000
    app.run(host="0.0.0.0", port=8001)
